home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / ab20_archive / sounds / tools / med-3.21.lha / Programmers / PlayerLibrary / library.doc < prev    next >
Text File  |  1992-01-01  |  10KB  |  328 lines

  1. ***************************************************************************
  2. *   Instructions for using "medplayer.library" V2, by Teijo Kinnunen      *
  3. ***************************************************************************
  4.  
  5. "medplayer.library" is a shared library, which can be used to load and play
  6. MED/OctaMED  4-channel modules You can call its functions from any language
  7. which supports library calls (C, Assembler, Basic...)
  8. (Note:    All functions must be called by the same task that opened the
  9.     library (using GetPlayer()). The library uses the task pointer
  10.     to keep track of the current user of the library.)
  11.  
  12. First  you  must  install  "medplayer.library" to your LIBS:  drawer (click
  13. Install_Libraries  to  do that).  You can also load it with ARP's "loadlib"
  14. command.
  15.  
  16. The main advantage of using medplayer.library instead of modplayer.a player
  17. routine  is  that you won't have to modify your program when new MED player
  18. routines   are   released.    The   user   will   just   have   to  replace
  19. medplayer.library  and  ZAP...   (sorry,  ZAP ;-) your program will support
  20. HexaMED  V63.132  (or  whatever  :-)  modules...   At the moment of writing
  21. (1.1.1992)  I  have been working on OctaMED Professional, which will have a
  22. new  module  format  incompatible  with  MMD0  (it'll be MMD1).  If you use
  23. medplayer.library, your programs will be compatible with MMD1s.
  24.  
  25. There's  a  header  file  'libproto.h'  that  contains  the  prototypes and
  26. #pragmas for use with SAS/Lattice C V5.
  27.  
  28. Here's  the  complete  list of the functions in "medplayer.library" (in RKM
  29. autodoc-style):
  30.  
  31. ---------------------------------------------------------------------------
  32. ---------------------------------------------------------------------------
  33.  
  34. GetPlayer
  35.  
  36. NAME
  37.     GetPlayer -- get and initialize the player routine
  38.  
  39. SYNOPSIS
  40.     error = GetPlayer(midi)
  41.     D0                D0
  42.  
  43. FUNCTION
  44.     This routine allocates the audio channels and CIAB timer A/B
  45.     and prepares the interrupt. If "midi" is nonzero, serial
  46.     port is allocated and initialized. You should call this
  47.     routine when your programs starts up.
  48.  
  49. INPUTS
  50.     midi =  0 no midi, 1 set up midi. When you use a song that
  51.         has only Amiga samples, there's no reason to allocate
  52.         the serial port. Then set midi to 0.
  53.  
  54. RESULT
  55.     If everything is OK, GetPlayer() returns zero. If initialization
  56.     failed or somebody else is currently using the library, then
  57.     GetPlayer() returns nonzero value.
  58.     NOTE: Even if GetPlayer() returned an error, you can still call
  59.           the library functions without making harm. They just won't
  60.           work (except LoadModule(), UnLoadModule(), RelocModule()
  61.           and GetCurrentModule(), which always work).
  62.  
  63. SEE ALSO
  64.     FreePlayer
  65.  
  66. ---------------------------------------------------------------------------
  67. ---------------------------------------------------------------------------
  68.  
  69. FreePlayer
  70.  
  71. NAME
  72.     FreePlayer -- free the resources allocated by GetPlayer()
  73.  
  74. SYNOPSIS
  75.     FreePlayer()
  76.  
  77. FUNCTION
  78.     This routine frees all resources allocated by GetPlayer().
  79.     Remember always call this routine before your program
  80.     exits. It doesn't harm to call this if GetPlayer() failed.
  81.     If you don't call this function during exit, audio channels,
  82.     timer etc. will remain allocated until reboot.
  83.  
  84. SEE ALSO
  85.     GetPlayer
  86.  
  87. ---------------------------------------------------------------------------
  88. ---------------------------------------------------------------------------
  89.  
  90. PlayModule
  91.  
  92. NAME
  93.     PlayModule -- play module from the beginning
  94.  
  95. SYNOPSIS
  96.     PlayModule(module)
  97.                A0
  98.  
  99. FUNCTION
  100.     This routine starts to play the module from the beginning.
  101.     The module can be obtained by calling LoadModule() or it can
  102.     be incorporated directly into your program. The module has to
  103.     be relocated before calling PlayModule()!
  104.  
  105. INPUTS
  106.     module = pointer to the module.
  107.  
  108. SEE ALSO
  109.     ContModule, StopPlayer
  110.  
  111. ---------------------------------------------------------------------------
  112. ---------------------------------------------------------------------------
  113.  
  114. ContModule
  115.  
  116. NAME
  117.     ContModule -- continue playing the module from where it stopped
  118.  
  119. SYNOPSIS
  120.     ContModule(module)
  121.                A0
  122.  
  123. FUNCTION
  124.     ContModule() functions just like PlayModule() except if you
  125.     have stopped playing with StopPlayer(), the playing will
  126.     continue where it stopped. When you play the module first
  127.     time, you should use PlayModule().
  128.  
  129. INPUTS
  130.     module = pointer to module.
  131.  
  132. SEE ALSO
  133.     PlayModule, StopPlayer
  134.  
  135. ---------------------------------------------------------------------------
  136. ---------------------------------------------------------------------------
  137.  
  138. StopPlayer
  139.  
  140. NAME
  141.     StopPlayer -- stops playing immediately
  142.  
  143. SYNOPSIS
  144.     StopPlayer()
  145.  
  146. FUNCTION
  147.     Stop.
  148.  
  149. SEE ALSO
  150.     PlayModule, ContModule
  151.  
  152. ---------------------------------------------------------------------------
  153. ---------------------------------------------------------------------------
  154.  
  155. DimOffPlayer
  156.  
  157. NOTE
  158.     This is an obsolete function! It was removed in V2 of the library,
  159.     and it now just does StopPlayer()!
  160.  
  161. ---------------------------------------------------------------------------
  162. ---------------------------------------------------------------------------
  163.  
  164. SetTempo
  165.  
  166. NAME
  167.     SetTempo -- modify the playing speed
  168.  
  169. SYNOPSIS
  170.     SetTempo(tempo)
  171.              D0
  172.  
  173. FUNCTION
  174.     If you want to modify the playback speed, you can call this one.
  175.     The tempo value should be 1 - 240. Note that tempos 1 - 10 are
  176.     recognized as SoundTracker tempos. This function usually has no
  177.     use.
  178.  
  179. INPUTS
  180.     tempo = new tempo
  181.  
  182. ---------------------------------------------------------------------------
  183. ---------------------------------------------------------------------------
  184.  
  185. LoadModule
  186.  
  187. NAME
  188.     LoadModule -- load a MED module from disk and relocate it
  189.  
  190. SYNOPSIS
  191.     module = LoadModule(name)
  192.     D0                  A0
  193.  
  194. FUNCTION
  195.     When you want to load a module from disk, call this function.
  196.     The function loads only MED modules (MMD0). It doesn't load
  197.     Tracker-modules, MED songs or object files. Only MMD0's
  198.     (MMD0 is the identification word at the beginning of the file).
  199.     Because the module contains many pointers, they must be
  200.     relocated. This function relocates the module automatically.
  201.     If you include the module as a binary file converted with
  202.     Objconv, YOU must relocate it. This is an easy thing to do.
  203.     Just call RelocModule().
  204.  
  205. INPUTS
  206.     name = pointer to file name (null-terminated)
  207.  
  208. RESULT
  209.     module = pointer to module. If failed to load for some reason
  210.              (disk error, out of memory, not a module), zero will
  211.           be returned.
  212.  
  213. SEE ALSO
  214.     UnLoadModule
  215.  
  216. ---------------------------------------------------------------------------
  217. ---------------------------------------------------------------------------
  218.  
  219. UnLoadModule
  220.  
  221. NAME
  222.     UnLoadModule -- frees the module from memory
  223.  
  224. SYNOPSIS
  225.     UnLoadModule(module)
  226.                  A0
  227. FUNCTION
  228.     When you don't need the module anymore, you MUST free the
  229.     memory it has used. Use this routine for it. Remember to
  230.     stop the player before unloading the module it is playing.
  231.  
  232.     NOTE: unload only those modules which are loaded with
  233.     LoadModule(). If you attempt to free module which is a part
  234.     of the program, you will cause guru 81000009/81000005.
  235.  
  236. INPUTS
  237.     module = pointer to module. If zero, nothing happens.
  238.  
  239. SEE ALSO
  240.     LoadModule
  241.  
  242. ---------------------------------------------------------------------------
  243. ---------------------------------------------------------------------------
  244.  
  245. GetCurrentModule
  246.  
  247. NAME
  248.     GetCurrentModule -- returns the address of module currently playing
  249.  
  250. SYNOPSIS
  251.     module = GetCurrentModule()
  252.     D0
  253.  
  254. FUNCTION
  255.     Simply returns the pointer of the module, which is currently
  256.     playing (or if player is stopped, which was played last). This
  257.     works also if some other task is currently playing. In this case,
  258.     because of multitasking, you should have no use for the value
  259.     (the module can be already unloaded). You may ask what use this
  260.     function has. Well, I'm not sure, but because this function
  261.     takes only 2 machine language instructions (8 bytes of memory)
  262.     there's not much harm of it.
  263.  
  264. RESULT
  265.     module = pointer to current module
  266.  
  267. ---------------------------------------------------------------------------
  268. ---------------------------------------------------------------------------
  269.  
  270. ResetMIDI
  271.  
  272. NAME
  273.     ResetMIDI -- reset all pitchbenders and modulation wheels and
  274.                  ask player to resend the preset values
  275.  
  276. SYNOPSIS
  277.     ResetMIDI()
  278.  
  279. FUNCTION
  280.     This function resets pitchbenders and modulation wheels on all
  281.     MIDI channels. It also asks the player to send again the
  282.     preset change requests for all instruments, so that the presets
  283.     will be correct if the user has changed them. It performs the
  284.     same function as MED's Ctrl-Space.
  285.  
  286. ---------------------------------------------------------------------------
  287. ---------------------------------------------------------------------------
  288. NOTE: THE FOLLOWING FUNCTIONS ARE ONLY AVAILABLE IN MEDPLAYER.LIBRARY V2
  289. OR LATER, BE SURE THAT YOU'RE REALLY USING V2 OF THE LIBRARY
  290. e.g.  MEDPlayerBase = OpenLibrary("medplayer.library",2);
  291. ---------------------------------------------------------------------------
  292. ---------------------------------------------------------------------------
  293.  
  294. SetModnum
  295.  
  296. NAME
  297.     SetModnum -- select the number of the song (in multi-module)
  298.  
  299. SYNOPSIS
  300.     SetModnum(modnum)
  301.           D0
  302.  
  303. FUNCTION
  304.     Use this function to set the number of song you want to play.
  305.     Call this before PlayModule(). 0 is the first song, 1 is the
  306.     second, and so on. If the module is not a multi-module, this
  307.     function has no affection.
  308.  
  309. ---------------------------------------------------------------------------
  310. ---------------------------------------------------------------------------
  311.  
  312. RelocModule
  313.  
  314. NAME
  315.     RelocModule -- relocate module
  316.  
  317. SYNOPSIS
  318.     RelocModule(module)
  319.             A0
  320.  
  321. FUNCTION
  322.     This function relocates the module. It should be used if you've
  323.     incorporated the module with Objconv program before using the
  324.     module. Note that LoadModule() automatically relocs everything.
  325.  
  326. ---------------------------------------------------------------------------
  327. ***************************************************************************
  328.